#include "jamod_global.h"

void JAMod_Attach(void)
{
	proxyCaller = GetModuleHandle("jagamex86.dll");
	jagamex86 = GetModuleHandle("ProxyDLL.dll");

	// don't want these exploding on us later on --eez
	assert(proxyCaller);
	assert(jagamex86);

	JAMod_BindExports();
	JAMod_DisplayMOTD();
	JAMod_LoadConfigFile();
	JAMod_LoadBasicPluginSettings();
	JAMod_DiscoverPlugins();	// Run various plugins now
}

void JAMod_Detach()
{
	JAMod_FreeFSMemory();
}

int __stdcall DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
	switch(dwReason)
	{
		case DLL_PROCESS_ATTACH:
			JAMod_Attach();
		case DLL_PROCESS_DETACH:
			JAMod_Detach();
			break;
	}
	return 1;
}